﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DomainDriver.DomainModeling.Constraints;
using DomainDriver.DomainModeling.DataProviders;
using DomainDriver.DomainModeling.DomainModels;

namespace DomainDriver.DomainModeling.GenericUnitTesting.Constraints
{
    // NOTE: Add "[TestFixture]" to sub-classes in actual test assembly

    public abstract class ConstraintTestFixture<DOMAIN_MODEL, CONSTRAINT> : DomainModelTestFixture<DOMAIN_MODEL>
        where DOMAIN_MODEL : class, IDomainModel
        where CONSTRAINT : class, IConstraint
    {
        public ConstraintTestFixture(DataSourcePersistenceType persistenceType)
            : base(persistenceType, true, true)
        { }

        [SetUp]
        public override void SetUp()
        {
            base.SetUp();

            foreach (IConstraint constraint in DomainModel.Constraints)
            {
                constraint.Enabled = false;
            }
            IConstraint constraintToTest = DomainModel.GetConstraint<CONSTRAINT>();
            constraintToTest.Enabled = true;
        }
    }
}